﻿using AiQiuQuan.Sport.Model.Enums;
using System.ComponentModel.DataAnnotations;

namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 活动评论
    /// </summary>
    public class CommentAddDto : IValidatableObject
    {
        /// <summary>
        /// 业务类型：5活动、6约球、10比赛
        /// </summary>
        [Required]
        public BusinessTypeEnum BusinessType { get; set; }

        /// <summary>
        /// 活动/约球/比赛ID
        /// </summary>
        [Required]
        public Guid BusinessId { get; set; }

        /// <summary>
        /// 父评论ID
        /// </summary>
        public Guid? ParentCommentId { get; set; }

        /// <summary>
        /// 评论
        /// </summary>
        [Required(AllowEmptyStrings = false)]
        public string Content { get; set; }

        /// <summary>
        /// validate
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (BusinessType != BusinessTypeEnum.Activity && BusinessType != BusinessTypeEnum.Ball && BusinessType != BusinessTypeEnum.Game)
            {
                yield return new ValidationResult("业务类型不正确");
                yield break;
            }
        }
    }
}
